<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body></body>
<script>
    // let arr = ['西游记', '唐僧', '孙悟空', '猪八戒', '沙僧']
    // console.log(arr.includes('唐僧'));
    // async function nihao() {
    //     // return '尚硅谷'
    //     return new Promise((resolve, reject) => {
    //         let success = "调用成功"
    //         resolve(success)
    //     })
    // }
    // console.log(nihao().then((res) => {
    //     console.log(res);
    // }));

    // //封装一个ajax
    // function ajax(url) {
    //     return new Promise((resolve, reject) => {
    //         var xhr = new XMLHttpRequest()
    //         xhr.open('GET', url)
    //         xhr.send()
    //         xhr.onreadystatechange = function() {
    //             if (xhr.readyState === 4) {
    //                 if (xhr.status >= 200 && xhr.status < 300) {
    //                     resolve(xhr.response)
    //                 }
    //             } else {
    //                 reject(xhr.status)
    //             }
    //         }

    //     })
    // }

    // async function tianqi() {
    //     const claim = await ajax('http://apis.juhe.cn/simpleWeather/query?city=%E8%8B%8F%E5%B7%9E&key="成都"')
    //     console.log(claim);
    // }
    // tianqi()、
    //对象的扩展方法
    const school = {
        name: "尚硅谷",
        cities: ["北京", "上海", "深圳"],
        xueke: ["前端", "java", "大数据", "运维"],
    };
    // 获取对象的所有键
    console.log(Object.keys(school));
    // 获取对象的所有值
    console.log(Object.values(school));
    //
    console.log(Object.entries(school));
    // 可以和Map函数结使用
    const s = new Map(Object.entries(school)); //创建了一个map的对象
    console.log(s);

    function aolier({
        yaoming,
        ai,
        ...user
    }) {
        console.log(yaoming);
        console.log(ai);
        console.log(user);
    }
    aolier({
        yaoming: "盖帽",
        ai: "身法",
        guo: "起跳",
        ke: "传奇",
    });

    const j = {
        tia: '盒马'
    }
    const bd = {
        tian: '先生'
    }
    let hhh = {...j,
        ...bd
    }
    console.log(hhh);
</script>

</html>